#ifndef _CAM_BASE_H_
#define _CAM_BASE_H_

//#include "log_api.h"
//#include <autoconf.h> /* generated automatically */


/**********************************************************************
*                           cam hw version                           *
**********************************************************************/
#define CAM_HW_VERSION_1 0x20180417 /* z1 */
#define CAM_HW_VERSION_2 0x20180813 /* z2 */
#define CAM_HW_VERSION_3 0x20181106 /* A0 */

//#if defined(CONFIG_BOARD_CRANE_EVB_Z2)
#define CONFIG_CAM_HW_VERSION CAM_HW_VERSION_3
//#else
//#define CONFIG_CAM_HW_VERSION CAM_HW_VERSION_1
//#endif

//#define BU_REG_READ(x) (*(volatile uint32_t *)(x))
//#define BU_REG_WRITE(x,y) ((*(volatile uint32_t *)(x)) = (y))

#define CAM_LOG_RETURN_LINE "\n"

typedef enum _CamLogLevel {
  CAMLOG_LEVEL_ERROR  = 100,
  CAMLOG_LEVEL_WARNING  = 200,
  CAMLOG_LEVEL_INFO  = 300,
  CAMLOG_LEVEL_DEBUG  = 400,
  CAMLOG_LEVEL_VERBOSE  = 500
}CamLogLevel;

#define CAMLOG_GLOBAL_LEVEL    CAMLOG_LEVEL_WARNING

#ifndef CAM_LOG_PRINT
#define CAM_LOG_PRINT(logLevel, levelName, format, ...)   \
  do {  \
    if (logLevel <= CAMLOG_GLOBAL_LEVEL) {  \
      printf(levelName ": " format CAM_LOG_RETURN_LINE, ##__VA_ARGS__);\
    }  \
  } while(0)
#endif

#define CAMLOGE(fmt, ...) CAM_LOG_PRINT(CAMLOG_LEVEL_ERROR, "[CAM]", fmt, ##__VA_ARGS__)
#define CAMLOGW(fmt, ...) CAM_LOG_PRINT(CAMLOG_LEVEL_WARNING, "[CAM]", fmt, ##__VA_ARGS__)
#define CAMLOGI(fmt, ...) CAM_LOG_PRINT(CAMLOG_LEVEL_INFO, "[CAM]", fmt, ##__VA_ARGS__)
#define CAMLOGD(fmt, ...) CAM_LOG_PRINT(CAMLOG_LEVEL_DEBUG, "[CAM]", fmt, ##__VA_ARGS__)
#define CAMLOGV(fmt, ...) CAM_LOG_PRINT(CAMLOG_LEVEL_VERBOSE, "[CAM]", fmt, ##__VA_ARGS__)

#endif //_CAM_CORE_H_
